namespace YMJake.Flowable.ExternalWorker.Client.AspNetCore.Pipeline;

/// <summary>
/// Delegate for worker middleware
/// </summary>
public delegate Task WorkerMiddleware(IWorkerPipelineContext context);

/// <summary>
/// Delegate for worker middleware factory
/// </summary>
public delegate WorkerMiddleware WorkerMiddlewareFactory(WorkerMiddleware next);

/// <summary>
/// Interface for configuring worker pipeline
/// </summary>
public interface IWorkerPipeline
{
    /// <summary>
    /// Add middleware to the pipeline
    /// </summary>
    IWorkerPipeline Use(WorkerMiddlewareFactory middleware);

    /// <summary>
    /// Add a handler to the pipeline
    /// </summary>
    IWorkerPipeline AddHandler<THandler>() where THandler : class, IWorkerHandler;

    /// <summary>
    /// Build the pipeline
    /// </summary>
    WorkerMiddleware Build();
}